<?php 
include('./includes/config.inc');
include('./includes/variables.inc');

//session_start();
//$rights = $_SESSION['rights'];

?><!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/xhtml1-strict.dtd" -->
<html>
<head>
<script language="javascript"  type="text/javascript" src="./includes/javascript/ajax.js"></script>

<script language="javascript" type="text/javascript">



function sendSearch (srchValue) {
   var srchType = document.getElementById('srchType').innerHTML;
   var srchStatus = document.getElementById('srchStatus').innerHTML;
   var srchCat = document.getElementById('srchCat').innerHTML;
   var srchHref = './sidebar.php?srchType=' + srchType + '&status=' + srchStatus + '&cat=' + srchCat;
   if (srchValue != null) srchHref += '&s=' + srchValue;
   parent.frames['sidebar'].location.href = srchHref;
}


function clearSearch () {
   document.getElementById('sideSearchBox').value ='';
   sendSearch('');
}


function setSrchType (srchType) {
   document.getElementById('srchType').innerHTML = srchType;
   sendSearchValue = document.getElementById('sideSearchBox').value;
   sendSearch(sendSearchValue);
}

function setStatus (statusValue) {
   document.getElementById('srchStatus').innerHTML = statusValue;
   sendSearchValue = document.getElementById('sideSearchBox').value;
   sendSearch(sendSearchValue);
}

function setCat (catValue) {
   document.getElementById('srchCat').innerHTML = catValue;
   sendSearchValue = document.getElementById('sideSearchBox').value;
   sendSearch(sendSearchValue);
}

function srchContext () {
   var srchContext = parent.document.getElementById('contextMenu');
   srchContext.setAttribute('onMouseOut', 'destroyContext()');
   srchContext.className = 'normalContext';
   srchContext.innerHTML = '<table class="normalContext" style="position: absolute; top: 20px; left: 20px; z-index: 5px; border-left: 1px solid white; border-top: 1px solid white; border-bottom: 1px solid black; border-right: 1px solid black;"><tr><td><span onClick="frames[\'sideHead\'].setStatus(1); destroyContext();" style="cursor: pointer; cursor: hand; ">Review</span><br /><span style="cursor: pointer; cursor: hand;"  onClick="frames[\'sideHead\'].setStatus(2); destroyContext();">New</span><br /><span style="cursor: pointer; cursor: hand;" onClick="frames[\'sideHead\'].setStatus(3); destroyContext();">Old</span><br />all</td></tr></table>';
}
</script>

<style>
.albumContext {
   visibility: visible;
   display: block;
   background-color: white;
   border: 1px solid #d6e6ff;
   width: 350px;
   height: 300px;
   }
.normalContext {
   visibility: visible;
   display: block;
   background-color: #c0c0c0;
   border: 1px solid #d6e6ff;
   }
.hidden {
	width: 0px; 
	visibility: hidden;
	display: none!important; 
	}
body {
	background-color: #d6e6ff;
	cursor: hand;
   }
select {
   width: 140px;
   border: 0px solid black;
   font-family: Times New Roman, Serif;
   }
</style>
</head>
<body style="background-color: #d6e6ff ;" onMouseDown="parent.destroyContext();"> 
<!-- onClick="parent.destroyContext();" -->

<form><span id="sideSearchSpan" style=""><!-- parent.srchCtxt(event.clientX, event.clientY) -->
<center><span style="background-color: white; display: inline; vertical-align: baseline;"><a style="display; inline;" onClick="document.getElementById('srchAdv').className = 'normal';"><img style="vertical-align: middle; border: 0px;" src="./themes/<?=$theme?>/img/button_search_inside.png" /></a><input type="text" style="border: none; background-color: white; height: 16px; width: 140px;" id="sideSearchBox" " onInput="sendSearch(this.value)" /><a href="" onClick="clearSearch()"><img style="vertical-align: middle; border: 0px;" src="./themes/<?=$theme?>/img/button_clear_inside.png" /></a></span><br />
<!-- 
<select id="srchStatus" name="srchStatus" tabindex="13">
	<option value="all">status: all</option>
	<option value="0">undatabased</option>
	<option value="1">in review</option>
	<option value="2">in rotation</option>
	<option value="3">old</option>
	<option value="4">archived</option>
	<option value="5">missing</option></select -->

<div id="srchAdv" class="hidden">
<select name="category" onChange="parent.frames['sideHead'].setCat(this.value);">
<option value="all">category: all</option>
<?php
//mysql_select_database($DB_NAME);
$catQuery = mysql_query("SELECT * FROM `category` ORDER BY `category` ") or die(mysql_error());
while ($cat = mysql_fetch_array($catQuery)) {
?><option value="<?=$cat[id]?>"<?php if ($cat['default']) print(' selected="selected"') ?>><?=$cat[category]?></option>
<?php
}
?>
</select>
<select onChange="parent.frames['sideHead'].setStatus(this.value);">
<option value="all">all</option>
<option value="1">in review</option>
<option value="2">in rotation</option>
<option value="3">old</option>
</select>

<select onChange="setSrchType(this.value);">
   <option value="all">search: all</option>
   <option value="art">artist</option>
   <option value="alb">album</option>
   <option value="trk">track</option>
   <option value="desc">description</option>
   <option value="slot">slot #</option>
   <option value="albId">disc ID</option>
   <option value="trkId">track ID</option>
   <option value="label">label</option>
   <option value="promo">promoter</option>
</select>
</div>	

<div id="contextContent" class="hidden">
<a onClick="top.destroyContext();">X</a><br />
<select name="category" onChange="parent.frames['sideHead'].setCat(this.value);">
<option value="all">category: all</option>
<?php
//mysql_select_database($DB_NAME);
$catQuery = mysql_query("SELECT * FROM `category` ORDER BY `category` ") or die(mysql_error());
while ($cat = mysql_fetch_array($catQuery)) {
?><option value="<?=$cat[id]?>"<?php if ($cat['default']) print(' selected="selected"') ?>><?=$cat[category]?></option>
<?php
}
?>
</select><br />
<select onChange="parent.frames['sideHead'].setStatus(this.value);">
<option value="all">all</option>
<option value="1">in review</option>
<option value="2">in rotation</option>
<option value="3">old</option>
</select>
</div>

	
	
</center>
</span>
<span id="srchType" class="hidden">art</span>
<!-- possible srchType data values {all, art, alb, trk, slot, albId, trkId} -->
<span id="srchStatus" class="hidden">all</span>
<span id="srchCat" class="hidden">all</span>
</form>
</body>
</html>
